﻿@using Library
@model Library.Models.Product

@{
    var modelCulture = Model.ProductCultures.SingleOrDefault(i => i.Culture == NOWCulture.CurrentCulture);
    var brandCulture = Model.Brand.BrandCultures.SingleOrDefault(i => i.Culture == NOWCulture.CurrentCulture) ?? Model.Brand.BrandCultures.First();
    var categoryCulture = Model.ProductCategory.ProductCategoryCultures.SingleOrDefault(i => i.Culture == NOWCulture.CurrentCulture) ?? Model.ProductCategory.ProductCategoryCultures.First();
}
@if (modelCulture != null)
{
    <tr data-id="@Model.Id">
        <th scope="row">@Html.DisplayFor(r => Model.Id)</th>
        <td>@Html.DisplayFor(r => modelCulture.Name)</td>
        <td>@Html.DisplayFor(r => brandCulture.Name)</td>
        <td>@Html.DisplayFor(r => categoryCulture.Name)</td>
        <td>
            <a class="btn btn-sm btn-info" href="@Url.Action("ProductGallery", new {@selectedCulture = NOWCulture.CurrentCulture, @id = Model.Id })" title="@NOWCulture.GetString("Gallery")"><span class="glyphicon glyphicon-picture"></span>@NOWCulture.GetString("Gallery")</a>
            <a class="btn btn-sm btn-success" href="@Url.Action("ProductSpecifications", new {@id = Model.Id})" title="@NOWCulture.GetString("Specifications")"><span class="glyphicon glyphicon-asterisk"></span>@NOWCulture.GetString("Specifications")</a>
            <a class="btn btn-sm btn-primary" href="@Url.Action("EditProduct", new {@selectedCulture = NOWCulture.CurrentCulture, @id = Model.Id})" title="@NOWCulture.GetString("Edit")"><span class="glyphicon glyphicon-edit"></span>@NOWCulture.GetString("Edit")</a>
            <button type="button" class="btn btn-sm btn-danger" data-editor="remove" data-id="@Model.Id"><span class="glyphicon glyphicon-remove"></span>@NOWCulture.GetString("Remove")</button>
        </td>
    </tr>
}



